package student;

public class student
{
    class Student
    {
        // 成员变量
        private String name;
        private String gender;
        private Date birthDate;
        // 类变量
        static String major;

        public Student(String name, String gender, Date birthDate)
        {
            this.name = name;
            this.gender = gender;
            this.birthDate = birthDate;
        }

        // 获取学生年龄的方法
        public int getAge()
        {
            Date currentDate = new Date();
            int age = currentDate.getYear() - birthDate.getYear();
            if (currentDate.getMonth() < birthDate.getMonth() || (currentDate.getMonth() == birthDate.getMonth() && currentDate.getDate() < birthDate.getDate())) {
                age--;
            }
            return age;
        }

        // 打印学生信息的类方法
        public static void printStudentInfo(Student student)
        {
            System.out.println("姓名：" + student.name + "，性别：" + student.gender + "，出生日期：" + student.birthDate + "，专业：" + major);
        }
    }
    public static void main(String[] args)
    {

    }
}
